package org.example.springdemo.Web.controller;

import org.example.springdemo.Result.WebResult;
import org.example.springdemo.Result.WebResultUtils;
import org.example.springdemo.Web.pojo.Dto.ObjectLimitDto;
import org.example.springdemo.Web.pojo.Vo.BookCategoryVo;
import org.example.springdemo.Web.pojo.Vo.ObjectLimitVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/BookCategory")
public class BookCategoryController {
    /**
     * 获取所有书籍类别
     *
     * @param objectLimitDto getCurrent() 当前页码 默认为1 和 getLimit() 每页显示数量 默认为10
     * @return WebResult<BookCategoryLimitVo> 返回所有书籍类别
     */
    @GetMapping("/BookCategory/list")
    public WebResult<ObjectLimitVo<BookCategoryVo>> getAllBookCategory(@RequestBody ObjectLimitDto objectLimitDto) {
        ObjectLimitVo<BookCategoryVo> bookCategoryLimitVo = new ObjectLimitVo<>();
        bookCategoryLimitVo.setData(List.of(
                new BookCategoryVo("1", "小说"),
                new BookCategoryVo("2", "历史"),
                new BookCategoryVo("3", "科技"),
                new BookCategoryVo("4", "文学"),
                new BookCategoryVo("5", "经济"),
                new BookCategoryVo("6", "哲学")
        ));

        return WebResultUtils.success( bookCategoryLimitVo);
    }
}
